# !/usr/bin python3                                 
# encoding: utf-8 -*-                            
# @author: 沙陌 微信：Matongxue_2
# @Time: 2021/10/20 21:04
# @Copyright：北京码同学
from pages.home_page import HomePage
from pages.login_page import LoginPage


class LoginActions:

    def login(self,username='18729399607',password='abc123456'):
        login_page = LoginPage()
        home_page = HomePage()
        # 由于ios的登录流出和安卓有些差异，那么为了兼容两种设备，所以在业务做处理
        if login_page.platfrom == 'ios':
            home_page.click_mine_menu()
            try:
                #点击其他方式登录
                login_page.click_other_login()
            except:
                pass
        login_page.click_pwd_login()
        if login_page.platfrom == 'ios':
            login_page.click_accept_proxy()
        login_page.send_keys_username(username)
        login_page.send_keys_password(password)
        return login_page.click_login_btn()